package com.example.mybatisplusj2300107.service.impl;

import com.example.mybatisplusj2300107.entity.Student;
import com.example.mybatisplusj2300107.mapper.StudentMapper;
import com.example.mybatisplusj2300107.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> selectAll() {
        List<Student> students = studentMapper.selectList(null);
        return students;
    }

    @Override
    public Student selectById(String studentId) {
        Student student = studentMapper.selectById(studentId);
        return student;
    }

    @Override
    public void update(Student student) {
        studentMapper.updateById(student);
    }

    @Override
    public void insert(Student student) {
        studentMapper.insert(student);
    }

    @Override
    public void deleteById(String studentId) {
        studentMapper.deleteById(studentId);
    }
}
